﻿<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
	<title>Sewise Player</title>
</head>
<body>
	<div style="width: 640px; height: 360px; ">
		<script type="text/javascript" src="http://219.232.161.204/libs/swfplayer/player/sewise.player.min.js?server=live&autostart=true&pid=vk5nx2cj
&shifttime=&buffer=1&lang=zh_CN&skin=liveWhite"></script>
	</div>
	<script>
		//直播接口调用方法
		function startPlay(){
			SewisePlayer.doPlay();
		}
		function playPause(){
			SewisePlayer.doPause();
		}
		function seekTo(){
			SewisePlayer.doSeek("20140224160520");
		}
		function playStop(){
			SewisePlayer.doStop();
		}
		function livePlay(){
			SewisePlayer.doLive();
		}
		function changeVolume(){
			SewisePlayer.setVolume(0.3);
		}
		function getLiveTime(){
			alert(SewisePlayer.liveTime());
		}
		function getPlayTime() {
			alert(SewisePlayer.playTime());
		}
		function switchChannel(){
			SewisePlayer.playChannel("br9anah3", "", true);
		}
		function switchStream(){
			SewisePlayer.toPlay("rtmp://192.168.1.219/livestream/7gw3yt3h", "title", "", true);
		}
		function toFullScreen(){
			SewisePlayer.fullScreen();
		}
		function toNoramlScreen(){
			SewisePlayer.noramlScreen();
		}
		function getBufferProgress() {
			alert(SewisePlayer.bufferProgress());
		}
		function setDuration(){
        	SewisePlayer.setDuration(1245);
		}

		
		//播放器回调方法
		function playerReady(name){
			console.log("Sewise Player On Ready 1");
			//SewisePlayer.toPlay("http://www.w3school.com.cn/i/movie.mp4", "title", 0, false);
		}
		SewisePlayer.playerReady(function(name){
			console.log("Sewise Player On Ready 2");
		});

		function onStart(name){
	        console.log("onStart 1");
		}
		SewisePlayer.onStart(function(name){
			 console.log("onStart 2");
		});

		function onStop(name){
			 console.log("onStop 1");
		}
		SewisePlayer.onStop(function(name){
			 console.log("onStop 2");
		});

		function onMetadata(meta, name){
			console.log("onMetadata 1");
		}
		SewisePlayer.onMetadata(function(meta, name){
			 console.log("onMetadata 2");
		});

		function onClarity(clarity, name){
			console.log("onClarity 1");
		}
		SewisePlayer.onClarity(function(clarity, name){
			 console.log("onClarity 2");
		});

		function onPause(name){
			console.log("onPause 1");
		}
		SewisePlayer.onPause(function(name){
			 console.log("onPause 2");
		});

		function onSeek(time, name){
			console.log("onSeek 1: " + time);
		}
		SewisePlayer.onSeek(function(time, name){
			console.log("onSeek 2: " + time);
		});

		function onPlayTime(time, name){
			console.log("onPlayTime 1: " + time);
		}
		SewisePlayer.onPlayTime(function(time, name){
			console.log("onPlayTime 2: " + time);
		});

		function onBuffer(pt, name){
			console.log("onBuffer 1: " + pt);
		}
		SewisePlayer.onBuffer(function(pt, name){
			console.log("onBuffer 2: " + pt);
		});
		
	</script>
	<div style="padding-top: 20px;">
		<div style="padding-right: 15px;float: left;">[直播接口]</div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:startPlay();">播放</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:playPause();">暂停</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:seekTo();">跳转</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:playStop();">停止</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:livePlay();">直播</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:changeVolume();">更改音量</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:getLiveTime();">直播时间</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:getPlayTime();">播放时间</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:switchChannel();">切换频道</a></div>
		<div style="padding-right: 15px;float: left;"><a href="javascript:switchStream();">切换流</a></div>
		<div style="padding-right: 20px;float: left;"><a href="javascript:toFullScreen();">全屏</a></div>
		<div style="padding-right: 20px;float: left;"><a href="javascript:toNoramlScreen();">普屏</a></div>
		<div style="padding-right: 20px;float: left;"><a href="javascript:getBufferProgress();">缓冲进度</a></div>
		<div style="padding-right: 20px;float: left;"><a href="javascript:setDuration();">设置时长</a></div>
		<br clear="all"/>
	</div>
	<div style="float: left; width: 100%; padding: 10px 30px; "><a href="https://github.com/jackzhang1204/sewise-player" target="_blank">Fork it on GitHub</a></div>
</body>
</html>